﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.quest.guide {
    import Engine.Managers.*;
    import Modules.quest.Managers.*;
    import Modules.guide.*;
    import Modules.guide.actions.*;

    public class QuestGuideActionReader extends GuideActionReader {

        protected var m_config:XML;
        protected var m_quest:GameQuest;

        public function QuestGuideActionReader(_arg1:QuestGuide, _arg2:XML, _arg3:GameQuest){
            super(_arg1);
            this.m_config = _arg2;
            this.m_quest = _arg3;
        }
        override public function readActions():void{
            var _local2:XML;
            var _local3:QuestGuideSequence;
            var _local4:Boolean;
            var _local5:XMLList;
            var _local6:XML;
            var _local7:String;
            var _local8:Class;
            var _local9:GuideAction;
            if (!this.m_config){
                ErrorManager.addError("Missing quest settings!");
                return;
            };
            var _local1:XMLList = this.m_config.guides.guide;
            for each (_local2 in _local1) {
                _local3 = new QuestGuideSequence(m_guide, this.m_quest);
                _local4 = _local3.createFromXml(_local2);
                if (_local4){
                    m_guide.registerSequence(_local3);
                    _local5 = _local2.action;
                    for each (_local6 in _local5) {
                        _local7 = String(_local6.@name);
                        _local8 = ACTIONS[_local7];
                        if (_local8 != null){
                            _local9 = (new (_local8)() as GuideAction);
                            _local9.setGuide(m_guide, _local3);
                            if (_local9.createFromXml(_local6)){
                                _local3.addAction(_local9);
                            } else {
                                ErrorManager.addError(("Failed to parse tutorial step for " + _local7));
                            };
                        } else {
                            ErrorManager.addError(("Unknown tutorial action: " + _local7));
                        };
                    };
                };
            };
        }

    }
}//package Modules.quest.guide 
